---
import Base from "@/layouts/Base.astro";
import PostSingle from "@/layouts/PostSingle.astro";
import { getSinglePage } from "@/lib/contentParser.astro";

export async function getStaticPaths() {
  const BLOG_FOLDER = "blog";
  const posts = await getSinglePage(BLOG_FOLDER);

  const paths = posts.map((post) => ({
    params: {
      single: post.id,
    },
    props: { post },
  }));
  return paths;
}

const { post } = Astro.props;
const { title, meta_title, description, image } = post.data;
---

<Base
  title={title}
  meta_title={meta_title}
  description={description}
  image={image}
>
  <PostSingle post={post} />
</Base>
